<template>
		<div style="display: flex;align-items: center;width: 100%;">
                                 <numberInput v-model="money1"  placeholder="请输入" type="number" style="width: 110px;">
								</numberInput>
                                <div style="width: 20px;text-align: center;">-</div>
                                <numberInput v-model="money2"  placeholder="请输入" type="number" style="width: 110px;">
                                </numberInput>
		</div>
</template>

<script>
    import numberInput from './number-input.vue'
	export default {
        components: {
			numberInput
		},
		props: {
			max: [String, Number],
            sttype:[String, Number],
		},
		data() {
			return {
                money1:'',
                money2:''
            }
		},
		watch: {
            money1(e){
                var money1 = this.money1
                var money2 = this.money2
                var money=''
                money = money1+','+money2
                // if(money1<money2){
                //     money = money1+','+money2
                // }else{
                //     money = money2+','+money1
                // }
                // if(Number(money1)==0&&Number(money2)==0){
                //     money = ''
                // }
                if(!money1&&!money2){
                    money = ''
                }
                if(money1&&money2){
                     if(money1<money2){
                        money = money1+','+money2
                    }else{
                        money = money2+','+money1
                    }
                }
                this.$emit('money',{money:money,sttype:this.sttype}) 
            },
            money2(e){
                var money1 = this.money1
                var money2 = this.money2
                var money=''
                money = money1+','+money2
                // if(money1<money2){
                //     money = money1+','+money2
                // }else{
                //     money = money2+','+money1
                // }
                if(!money1&&!money2){
                    money = ''
                }
                if(money1&&money2){
                     if(money1<money2){
                        money = money1+','+money2
                    }else{
                        money = money2+','+money1
                    }
                }
                this.$emit('money',{money:money,sttype:this.sttype}) 
            }
        },
		created() {},
		methods: {
            rechar(){
                const that = this
                this.money1 = ''
                this.money2 = ''
                that.$forceUpdate()
            }
		}
	}
</script>

<style>
</style>
